package com.flynn.rock.system.convert;

import com.flynn.rock.model.dto.OperateLogDto;
import com.flynn.rock.system.entity.SysOperateLogEntity;
import com.flynn.rock.system.model.vo.OperateLogVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public abstract class AbstractOperateLogConvert {

    public static final AbstractOperateLogConvert INSTANCE = Mappers.getMapper(AbstractOperateLogConvert.class);

    public abstract SysOperateLogEntity toOperateLogEntity(OperateLogDto operateLog);

    @Mapping(target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
    public abstract OperateLogVo toOperateLogVo(SysOperateLogEntity entity);
}
